<template>
  <el-menu
    :default-active="active"
    class="el-menu-vertical-wrap"
    :collapse="isCollapse"
    @select="handleSelect"
  >
    <div class="logo">log</div>
    <!-- <el-button class="switch-btn" type="info" @click="isCollapse = !isCollapse"></el-button> -->
    <el-menu-item :index="item.routeName" v-for="item in navs" :key="item.index">
      <i :class="item.icon"></i>
      <span slot="title">{{item.name}}</span>
    </el-menu-item>
  </el-menu>
</template>

<script>
export default {
  data() {
    return {
      isCollapse: false,
      active: "dashboard",
      navs: [
        {
          name: "首页看板",
          routeName: "admin-dashboard",
          icon: "el-icon-document",
          index: "1"
        },
        {
          name: "文章管理",
          routeName: "admin-article",
          icon: "el-icon-document",
          index: "2"
        },
        {
          name: "文件管理",
          routeName: "admin-file",
          icon: "el-icon-document",
          index: "3"
        },
        {
          name: "标签管理",
          routeName: "admin-tag",
          icon: "el-icon-document",
          index: "4"
        },
        {
          name: "留言管理",
          routeName: "admin-comment",
          icon: "el-icon-document",
          index: "5"
        },
        {
          name: "用户管理",
          routeName: "admin-user",
          icon: "el-icon-document",
          index: "6"
        }
      ]
    };
  },
  methods: {
    handleSelect(res) {
      this.$router.push({ name: res });
    }
  }
};
</script>

<style lang="scss" scoped>
.el-menu-vertical-wrap {
  .logo {
    height: 60px;
  }
  width: 160px;
  height: 100%;
  border-right: 0;
  background: #d9d9d9;
}
</style>